import storage from '@/common/js/storage';
module.exports = {
	data() {
		return {
			
		}
	},
	methods: {
		getUserInfo(fn) {
		    uni.getUserProfile({
		        desc: '用户头像展示',
		        success: async (result) => {
		            const data = {
		                avatar: result.userInfo.avatarUrl,
		                encryptedData: result.encryptedData,
		                iv: result.iv,
		                jsCode: this.code,
		                nickname: result.userInfo.nickName,
						miniProgramType: 38,
		            };
					storage.remove('uid')
		            this.$u.post('/wx/authorize/login', data).then((res) => {
						if(res.status == -1) {
							return
						}
		                storage.set('uid', res.uid);
						this.$u.get('/paopao/mini/user/getUsersInfo').then((data) => {
							uni.showToast({
								title: '登录成功'
							});
						    fn && fn();
						});
		            });
		        },
		        fail: (error) => {
		            console.log(error);
		        },
		    });
		},
	}
}